package com.black.order.interceptor;

import cn.hutool.core.lang.UUID;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: Young
 * @CreateTime: 2025-08-04
 * @Description: openfeign请求拦截器，可以远程调用前做一些动作，例如添加参数
 * @Version: 1.0
 */
@Component
public class XTokenRequestInterceptor implements RequestInterceptor {
    /**
     * 请求拦截器
     * 每次请求前都会调用
     * @param requestTemplate
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header("X-Token", UUID.randomUUID().toString());
    }
}
